﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson.Serialization.Attributes;



namespace MongoPerfTest
{

    public class ScoringLine 
    {
        public double Score {get;set;}
        public double Weight {get;set;}        
        public double WeightRelative {get;set;}
        public string Name {get;set;}
    }
    public class ScoringMatrix
    {
        public int count { get; set; }
        public int countB { get; set; }
        [BsonId]
        public Guid Id { get; set; }
        public Guid CompanyId { get; set; }        
        public Guid MatrixId { get; set; }
        public Guid PeerGroupId { get; set; }
        public Guid ParentGroupId { get; set; }
        public string PeerGroupName { get; set; }
        public int WorkingVersion { get; set; }
        public string CompanyName { get; set; }
        public double CompanyScore { get; set; }


        //themes
        public ScoringLine E { get; set; }
        public ScoringLine S { get; set; }
        public ScoringLine G { get; set; }
        public ScoringLine P { get; set; }


        //topics
        public ScoringLine E_1 { get; set; }
        public ScoringLine E_2 { get; set; }
        public ScoringLine E_3 { get; set; }

        public ScoringLine S_1 { get; set; }
        public ScoringLine S_2 { get; set; }
        public ScoringLine S_3 { get; set; }
        public ScoringLine S_4 { get; set; }
        public ScoringLine S_5 { get; set; }

        public ScoringLine G_1 { get; set; }
        public ScoringLine G_2 { get; set; }
        public ScoringLine G_3 { get; set; }

        //indicators

        public ScoringLine G_1_1 { get; set; }
        public ScoringLine G_1_1_1 { get; set; }
        public ScoringLine G_1_2 { get; set; }
        public ScoringLine G_1_3 { get; set; }
        public ScoringLine G_1_3_1 { get; set; }
        public ScoringLine G_1_3_2 { get; set; }
        public ScoringLine G_1_3_3 { get; set; }
        public ScoringLine G_1_3_4 { get; set; }
        public ScoringLine G_1_3_5 { get; set; }
        public ScoringLine G_1_4 { get; set; }
        public ScoringLine G_1_4_1 { get; set; }
        public ScoringLine G_1_4_3 { get; set; }
        public ScoringLine G_1_4_4 { get; set; }
        public ScoringLine G_1_4_5 { get; set; }
        public ScoringLine G_1_4_6 { get; set; }
        public ScoringLine G_1_5 { get; set; }
        public ScoringLine G_2_1 { get; set; }
        public ScoringLine G_2_2 { get; set; }
        public ScoringLine G_2_3 { get; set; }
        public ScoringLine G_2_4 { get; set; }
        public ScoringLine G_2_5 { get; set; }
        public ScoringLine G_2_5_1 { get; set; }
        public ScoringLine G_2_6 { get; set; }
        public ScoringLine G_2_7 { get; set; }
        public ScoringLine G_2_8 { get; set; }
        public ScoringLine G_2_9 { get; set; }
        public ScoringLine G_2_10 { get; set; }
        public ScoringLine G_2_11 { get; set; }
        public ScoringLine G_2_12 { get; set; }
        public ScoringLine G_2_13 { get; set; }
        public ScoringLine G_3_1 { get; set; }
        public ScoringLine G_3_2 { get; set; }
        public ScoringLine G_3_3_1 { get; set; }
        public ScoringLine G_3_4 { get; set; }
        public ScoringLine S_1_1 { get; set; }
        public ScoringLine S_1_1_1 { get; set; }
        public ScoringLine S_1_2 { get; set; }
        public ScoringLine S_1_3 { get; set; }
        public ScoringLine S_1_4 { get; set; }
        public ScoringLine S_1_5 { get; set; }
        public ScoringLine S_1_5_1 { get; set; }
        public ScoringLine S_1_6 { get; set; }
        public ScoringLine S_1_6_1 { get; set; }
        public ScoringLine S_1_6_2 { get; set; }
        public ScoringLine S_1_6_3 { get; set; }
        public ScoringLine S_1_6_4 { get; set; }
        public ScoringLine S_1_6_5 { get; set; }
        public ScoringLine S_1_6_6 { get; set; }
        public ScoringLine S_1_7 { get; set; }
        public ScoringLine S_2_1 { get; set; }
        public ScoringLine S_2_1_1 { get; set; }
        public ScoringLine S_2_1_2 { get; set; }
        public ScoringLine S_2_1_3 { get; set; }
        public ScoringLine S_2_2 { get; set; }
        public ScoringLine S_2_2_1 { get; set; }
        public ScoringLine S_2_2_2 { get; set; }
        public ScoringLine S_2_2_3 { get; set; }
        public ScoringLine S_2_2_4 { get; set; }
        public ScoringLine S_2_3 { get; set; }
        public ScoringLine S_3_1_1 { get; set; }
        public ScoringLine S_3_1_2 { get; set; }
        public ScoringLine S_3_1_3 { get; set; }
        public ScoringLine S_3_1_4 { get; set; }
        public ScoringLine S_3_1_5 { get; set; }
        public ScoringLine S_3_1_6 { get; set; }
        public ScoringLine S_3_1_7 { get; set; }
        public ScoringLine S_3_1_8 { get; set; }
        public ScoringLine S_3_1_9 { get; set; }
        public ScoringLine S_3_1_10 { get; set; }
        public ScoringLine S_3_1_11 { get; set; }
        public ScoringLine S_3_1_12 { get; set; }
        public ScoringLine S_3_2_1 { get; set; }
        public ScoringLine S_3_3 { get; set; }
        public ScoringLine S_4_1 { get; set; }
        public ScoringLine S_4_2_1 { get; set; }
        public ScoringLine S_4_2_2 { get; set; }
        public ScoringLine S_4_2_3 { get; set; }
        public ScoringLine S_4_2_4 { get; set; }
        public ScoringLine S_4_2_5 { get; set; }
        public ScoringLine S_4_2_6 { get; set; }
        public ScoringLine S_4_2_7 { get; set; }
        public ScoringLine S_4_2_8 { get; set; }
        public ScoringLine S_4_2_9 { get; set; }
        public ScoringLine S_4_2_10 { get; set; }
        public ScoringLine S_4_2_11 { get; set; }
        public ScoringLine S_4_2_12 { get; set; }
        public ScoringLine S_4_2_13 { get; set; }
        public ScoringLine S_4_2_14 { get; set; }
        public ScoringLine S_4_3 { get; set; }
        public ScoringLine S_5_1 { get; set; }
        public ScoringLine S_5_2 { get; set; }
        public ScoringLine S_5_3 { get; set; }
        public ScoringLine E_1_1 { get; set; }
        public ScoringLine E_1_1_1 { get; set; }
        public ScoringLine E_1_2 { get; set; }
        public ScoringLine E_1_2_1 { get; set; }
        public ScoringLine E_1_2_2 { get; set; }
        public ScoringLine E_1_2_3 { get; set; }
        public ScoringLine E_1_2_4 { get; set; }
        public ScoringLine E_1_2_6 { get; set; }
        public ScoringLine E_1_2_7 { get; set; }
        public ScoringLine E_1_2_8 { get; set; }
        public ScoringLine E_1_3 { get; set; }
        public ScoringLine E_1_3_2 { get; set; }
        public ScoringLine E_1_3_3 { get; set; }
        public ScoringLine E_1_3_4 { get; set; }
        public ScoringLine E_1_3_5 { get; set; }
        public ScoringLine E_1_4 { get; set; }
        public ScoringLine E_1_5 { get; set; }
        public ScoringLine E_1_6 { get; set; }
        public ScoringLine E_1_7 { get; set; }
        public ScoringLine E_1_7_1 { get; set; }
        public ScoringLine E_1_7_2 { get; set; }
        public ScoringLine E_1_8 { get; set; }
        public ScoringLine E_1_9 { get; set; }
        public ScoringLine E_1_10 { get; set; }
        public ScoringLine E_1_11 { get; set; }
        public ScoringLine E_1_12 { get; set; }
        public ScoringLine E_2_1 { get; set; }
        public ScoringLine E_2_1_1 { get; set; }
        public ScoringLine E_2_1_2 { get; set; }
        public ScoringLine E_2_1_3 { get; set; }
        public ScoringLine E_2_1_4 { get; set; }
        public ScoringLine E_2_1_5 { get; set; }
        public ScoringLine E_2_1_6 { get; set; }
        public ScoringLine E_2_1_7 { get; set; }
        public ScoringLine E_2_1_8 { get; set; }
        public ScoringLine E_2_1_9 { get; set; }
        public ScoringLine E_2_1_10 { get; set; }
        public ScoringLine E_2_2 { get; set; }
        public ScoringLine E_3_1_1 { get; set; }
        public ScoringLine E_3_1_2 { get; set; }
        public ScoringLine E_3_1_3 { get; set; }
        public ScoringLine E_3_1_4 { get; set; }
        public ScoringLine E_3_1_5 { get; set; }
        public ScoringLine E_3_1_6 { get; set; }
        public ScoringLine E_3_1_7 { get; set; }
        public ScoringLine E_3_1_8 { get; set; }
        public ScoringLine E_3_1_9 { get; set; }
        public ScoringLine E_3_1_10 { get; set; }
        public ScoringLine E_3_1_11 { get; set; }
        public ScoringLine E_3_1_12 { get; set; }
        public ScoringLine E_3_1_13 { get; set; }
        public ScoringLine E_3_1_14 { get; set; }
        public ScoringLine E_3_1_15 { get; set; }
        public ScoringLine E_3_1_16 { get; set; }
        public ScoringLine E_3_1_17 { get; set; }
        public ScoringLine E_3_2 { get; set; }
        public ScoringLine P_1 { get; set; }
        public ScoringLine P_2 { get; set; }
        public ScoringLine P_3 { get; set; }
        public ScoringLine P_4 { get; set; }
        public ScoringLine P_5 { get; set; }
        public ScoringLine P_6 { get; set; }
        public ScoringLine P_7 { get; set; }
        public ScoringLine P_8 { get; set; }
        public ScoringLine P_9 { get; set; }
        public ScoringLine P_10 { get; set; }
        public ScoringLine P_11 { get; set; }
        public ScoringLine P_12 { get; set; }


        public void SetIndicatorValues(string indicatorName, double? scoring, double? weight, double? relativeWeight, string details = null)
        {
            var sl = GetIndicator(indicatorName);
            System.Diagnostics.Debug.Assert(sl != null);            
            if (sl != null)
            {
                if (scoring.HasValue)
                    sl.Score = Math.Round(scoring.Value, 2);
                if (weight.HasValue)
                    sl.Weight = Math.Round(weight.Value, 2);
                if (relativeWeight.HasValue)
                    sl.WeightRelative = Math.Round(relativeWeight.Value, 2);
                if (details != null)
                    sl.Name = details;
            }
        }

        private ScoringLine GetIndicator(string indicatorName)
        {
            switch (indicatorName)
            {


                case "E": return E = (E??new ScoringLine());
                case "S": return S = (S??new ScoringLine());
                case "G": return G = (G??new ScoringLine());
                case "P": return P = (P ?? new ScoringLine());

                case "E.1": return E_1 = (E_1 ?? new ScoringLine());
                case "E.2": return E_2 = (E_2 ?? new ScoringLine());
                case "E.3": return E_3 = (E_3 ?? new ScoringLine());

                case "S.1": return S_1 = (S_1 ?? new ScoringLine());
                case "S.2": return S_2 = (S_2 ?? new ScoringLine());
                case "S.3": return S_3 = (S_3 ?? new ScoringLine());
                case "S.4": return S_4 = (S_4 ?? new ScoringLine());
                case "S.5": return S_5 = (S_5 ?? new ScoringLine());

                case "G.1": return G_1 = (G_1 ?? new ScoringLine());
                case "G.2": return G_2 = (G_2 ?? new ScoringLine());
                case "G.3": return G_3 = (G_3 ?? new ScoringLine());

                case "G.1.1": return G_1_1 = (G_1_1 ?? new ScoringLine() );
                case "G.1.1.1": return G_1_1_1 = (G_1_1_1 ?? new ScoringLine() );
                case "G.1.2": return G_1_2 = (G_1_2 ?? new ScoringLine() );
                case "G.1.3": return G_1_3 = (G_1_3 ?? new ScoringLine() );
                case "G.1.3.1": return G_1_3_1 = (G_1_3_1 ?? new ScoringLine() );
                case "G.1.3.2": return G_1_3_2 = (G_1_3_2 ?? new ScoringLine() );
                case "G.1.3.3": return G_1_3_3 = (G_1_3_3 ?? new ScoringLine() );
                case "G.1.3.4": return G_1_3_4 = (G_1_3_4 ?? new ScoringLine() );
                case "G.1.3.5": return G_1_3_5 = (G_1_3_5 ?? new ScoringLine() );
                case "G.1.4": return G_1_4 = (G_1_4 ?? new ScoringLine() );
                case "G.1.4.1": return G_1_4_1 = (G_1_4_1 ?? new ScoringLine() );
                case "G.1.4.3": return G_1_4_3 = (G_1_4_3 ?? new ScoringLine() );
                case "G.1.4.4": return G_1_4_4 = (G_1_4_4 ?? new ScoringLine() );
                case "G.1.4.5": return G_1_4_5 = (G_1_4_5 ?? new ScoringLine() );
                case "G.1.4.6": return G_1_4_6 = (G_1_4_6 ?? new ScoringLine() );
                case "G.1.5": return G_1_5 = (G_1_5 ?? new ScoringLine() );
                case "G.2.1": return G_2_1 = (G_2_1 ?? new ScoringLine() );
                case "G.2.2": return G_2_2 = (G_2_2 ?? new ScoringLine() );
                case "G.2.3": return G_2_3 = (G_2_3 ?? new ScoringLine() );
                case "G.2.4": return G_2_4 = (G_2_4 ?? new ScoringLine() );
                case "G.2.5": return G_2_5 = (G_2_5 ?? new ScoringLine() );
                case "G.2.5.1": return G_2_5_1 = (G_2_5_1 ?? new ScoringLine() );
                case "G.2.6": return G_2_6 = (G_2_6 ?? new ScoringLine() );
                case "G.2.7": return G_2_7 = (G_2_7 ?? new ScoringLine() );
                case "G.2.8": return G_2_8 = (G_2_8 ?? new ScoringLine() );
                case "G.2.9": return G_2_9 = (G_2_9 ?? new ScoringLine() );
                case "G.2.10": return G_2_10 = (G_2_10 ?? new ScoringLine() );
                case "G.2.11": return G_2_11 = (G_2_11 ?? new ScoringLine() );
                case "G.2.12": return G_2_12 = (G_2_12 ?? new ScoringLine() );
                case "G.2.13": return G_2_13 = (G_2_13 ?? new ScoringLine() );
                case "G.3.1": return G_3_1 = (G_3_1 ?? new ScoringLine() );
                case "G.3.2": return G_3_2 = (G_3_2 ?? new ScoringLine() );
                case "G.3.3.1": return G_3_3_1 = (G_3_3_1 ?? new ScoringLine() );
                case "G.3.4": return G_3_4 = (G_3_4 ?? new ScoringLine() );
                case "S.1.1": return S_1_1 = (S_1_1 ?? new ScoringLine() );
                case "S.1.1.1": return S_1_1_1 = (S_1_1_1 ?? new ScoringLine() );
                case "S.1.2": return S_1_2 = (S_1_2 ?? new ScoringLine() );
                case "S.1.3": return S_1_3 = (S_1_3 ?? new ScoringLine() );
                case "S.1.4": return S_1_4 = (S_1_4 ?? new ScoringLine() );
                case "S.1.5": return S_1_5 = (S_1_5 ?? new ScoringLine() );
                case "S.1.5.1": return S_1_5_1 = (S_1_5_1 ?? new ScoringLine() );
                case "S.1.6": return S_1_6 = (S_1_6 ?? new ScoringLine() );
                case "S.1.6.1": return S_1_6_1 = (S_1_6_1 ?? new ScoringLine() );
                case "S.1.6.2": return S_1_6_2 = (S_1_6_2 ?? new ScoringLine() );
                case "S.1.6.3": return S_1_6_3 = (S_1_6_3 ?? new ScoringLine() );
                case "S.1.6.4": return S_1_6_4 = (S_1_6_4 ?? new ScoringLine() );
                case "S.1.6.5": return S_1_6_5 = (S_1_6_5 ?? new ScoringLine() );
                case "S.1.6.6": return S_1_6_6 = (S_1_6_6 ?? new ScoringLine() );
                case "S.1.7": return S_1_7 = (S_1_7 ?? new ScoringLine() );
                case "S.2.1": return S_2_1 = (S_2_1 ?? new ScoringLine() );
                case "S.2.1.1": return S_2_1_1 = (S_2_1_1 ?? new ScoringLine() );
                case "S.2.1.2": return S_2_1_2 = (S_2_1_2 ?? new ScoringLine() );
                case "S.2.1.3": return S_2_1_3 = (S_2_1_3 ?? new ScoringLine() );
                case "S.2.2": return S_2_2 = (S_2_2 ?? new ScoringLine() );
                case "S.2.2.1": return S_2_2_1 = (S_2_2_1 ?? new ScoringLine() );
                case "S.2.2.2": return S_2_2_2 = (S_2_2_2 ?? new ScoringLine() );
                case "S.2.2.3": return S_2_2_3 = (S_2_2_3 ?? new ScoringLine() );
                case "S.2.2.4": return S_2_2_4 = (S_2_2_4 ?? new ScoringLine() );
                case "S.2.3": return S_2_3 = (S_2_3 ?? new ScoringLine() );
                case "S.3.1.1": return S_3_1_1 = (S_3_1_1 ?? new ScoringLine() );
                case "S.3.1.2": return S_3_1_2 = (S_3_1_2 ?? new ScoringLine() );
                case "S.3.1.3": return S_3_1_3 = (S_3_1_3 ?? new ScoringLine() );
                case "S.3.1.4": return S_3_1_4 = (S_3_1_4 ?? new ScoringLine() );
                case "S.3.1.5": return S_3_1_5 = (S_3_1_5 ?? new ScoringLine() );
                case "S.3.1.6": return S_3_1_6 = (S_3_1_6 ?? new ScoringLine() );
                case "S.3.1.7": return S_3_1_7 = (S_3_1_7 ?? new ScoringLine() );
                case "S.3.1.8": return S_3_1_8 = (S_3_1_8 ?? new ScoringLine() );
                case "S.3.1.9": return S_3_1_9 = (S_3_1_9 ?? new ScoringLine() );
                case "S.3.1.10": return S_3_1_10 = (S_3_1_10 ?? new ScoringLine() );
                case "S.3.1.11": return S_3_1_11 = (S_3_1_11 ?? new ScoringLine() );
                case "S.3.1.12": return S_3_1_12 = (S_3_1_12 ?? new ScoringLine() );
                case "S.3.2.1": return S_3_2_1 = (S_3_2_1 ?? new ScoringLine() );
                case "S.3.3": return S_3_3 = (S_3_3 ?? new ScoringLine() );
                case "S.4.1": return S_4_1 = (S_4_1 ?? new ScoringLine() );
                case "S.4.2.1": return S_4_2_1 = (S_4_2_1 ?? new ScoringLine() );
                case "S.4.2.2": return S_4_2_2 = (S_4_2_2 ?? new ScoringLine() );
                case "S.4.2.3": return S_4_2_3 = (S_4_2_3 ?? new ScoringLine() );
                case "S.4.2.4": return S_4_2_4 = (S_4_2_4 ?? new ScoringLine() );
                case "S.4.2.5": return S_4_2_5 = (S_4_2_5 ?? new ScoringLine() );
                case "S.4.2.6": return S_4_2_6 = (S_4_2_6 ?? new ScoringLine() );
                case "S.4.2.7": return S_4_2_7 = (S_4_2_7 ?? new ScoringLine() );
                case "S.4.2.8": return S_4_2_8 = (S_4_2_8 ?? new ScoringLine() );
                case "S.4.2.9": return S_4_2_9 = (S_4_2_9 ?? new ScoringLine() );
                case "S.4.2.10": return S_4_2_10 = (S_4_2_10 ?? new ScoringLine() );
                case "S.4.2.11": return S_4_2_11 = (S_4_2_11 ?? new ScoringLine() );
                case "S.4.2.12": return S_4_2_12 = (S_4_2_12 ?? new ScoringLine() );
                case "S.4.2.13": return S_4_2_13 = (S_4_2_13 ?? new ScoringLine() );
                case "S.4.2.14": return S_4_2_14 = (S_4_2_14 ?? new ScoringLine() );
                case "S.4.3": return S_4_3 = (S_4_3 ?? new ScoringLine() );
                case "S.5.1": return S_5_1 = (S_5_1 ?? new ScoringLine() );
                case "S.5.2": return S_5_2 = (S_5_2 ?? new ScoringLine() );
                case "S.5.3": return S_5_3 = (S_5_3 ?? new ScoringLine() );
                case "E.1.1": return E_1_1 = (E_1_1 ?? new ScoringLine() );
                case "E.1.1.1": return E_1_1_1 = (E_1_1_1 ?? new ScoringLine() );
                case "E.1.2": return E_1_2 = (E_1_2 ?? new ScoringLine() );
                case "E.1.2.1": return E_1_2_1 = (E_1_2_1 ?? new ScoringLine() );
                case "E.1.2.2": return E_1_2_2 = (E_1_2_2 ?? new ScoringLine() );
                case "E.1.2.3": return E_1_2_3 = (E_1_2_3 ?? new ScoringLine() );
                case "E.1.2.4": return E_1_2_4 = (E_1_2_4 ?? new ScoringLine() );
                case "E.1.2.6": return E_1_2_6 = (E_1_2_6 ?? new ScoringLine() );
                case "E.1.2.7": return E_1_2_7 = (E_1_2_7 ?? new ScoringLine() );
                case "E.1.2.8": return E_1_2_8 = (E_1_2_8 ?? new ScoringLine() );
                case "E.1.3": return E_1_3 = (E_1_3 ?? new ScoringLine() );
                case "E.1.3.2": return E_1_3_2 = (E_1_3_2 ?? new ScoringLine() );
                case "E.1.3.3": return E_1_3_3 = (E_1_3_3 ?? new ScoringLine() );
                case "E.1.3.4": return E_1_3_4 = (E_1_3_4 ?? new ScoringLine() );
                case "E.1.3.5": return E_1_3_5 = (E_1_3_5 ?? new ScoringLine() );
                case "E.1.4": return E_1_4 = (E_1_4 ?? new ScoringLine() );
                case "E.1.5": return E_1_5 = (E_1_5 ?? new ScoringLine() );
                case "E.1.6": return E_1_6 = (E_1_6 ?? new ScoringLine() );
                case "E.1.7": return E_1_7 = (E_1_7 ?? new ScoringLine() );
                case "E.1.7.1": return E_1_7_1 = (E_1_7_1 ?? new ScoringLine() );
                case "E.1.7.2": return E_1_7_2 = (E_1_7_2 ?? new ScoringLine() );
                case "E.1.8": return E_1_8 = (E_1_8 ?? new ScoringLine() );
                case "E.1.9": return E_1_9 = (E_1_9 ?? new ScoringLine() );
                case "E.1.10": return E_1_10 = (E_1_10 ?? new ScoringLine() );
                case "E.1.11": return E_1_11 = (E_1_11 ?? new ScoringLine() );
                case "E.1.12": return E_1_12 = (E_1_12 ?? new ScoringLine() );
                case "E.2.1": return E_2_1 = (E_2_1 ?? new ScoringLine() );
                case "E.2.1.1": return E_2_1_1 = (E_2_1_1 ?? new ScoringLine() );
                case "E.2.1.2": return E_2_1_2 = (E_2_1_2 ?? new ScoringLine() );
                case "E.2.1.3": return E_2_1_3 = (E_2_1_3 ?? new ScoringLine() );
                case "E.2.1.4": return E_2_1_4 = (E_2_1_4 ?? new ScoringLine() );
                case "E.2.1.5": return E_2_1_5 = (E_2_1_5 ?? new ScoringLine() );
                case "E.2.1.6": return E_2_1_6 = (E_2_1_6 ?? new ScoringLine() );
                case "E.2.1.7": return E_2_1_7 = (E_2_1_7 ?? new ScoringLine() );
                case "E.2.1.8": return E_2_1_8 = (E_2_1_8 ?? new ScoringLine() );
                case "E.2.1.9": return E_2_1_9 = (E_2_1_9 ?? new ScoringLine() );
                case "E.2.1.10": return E_2_1_10 = (E_2_1_10 ?? new ScoringLine() );
                case "E.2.2": return E_2_2 = (E_2_2 ?? new ScoringLine() );
                case "E.3.1.1": return E_3_1_1 = (E_3_1_1 ?? new ScoringLine() );
                case "E.3.1.2": return E_3_1_2 = (E_3_1_2 ?? new ScoringLine() );
                case "E.3.1.3": return E_3_1_3 = (E_3_1_3 ?? new ScoringLine() );
                case "E.3.1.4": return E_3_1_4 = (E_3_1_4 ?? new ScoringLine() );
                case "E.3.1.5": return E_3_1_5 = (E_3_1_5 ?? new ScoringLine() );
                case "E.3.1.6": return E_3_1_6 = (E_3_1_6 ?? new ScoringLine() );
                case "E.3.1.7": return E_3_1_7 = (E_3_1_7 ?? new ScoringLine() );
                case "E.3.1.8": return E_3_1_8 = (E_3_1_8 ?? new ScoringLine() );
                case "E.3.1.9": return E_3_1_9 = (E_3_1_9 ?? new ScoringLine() );
                case "E.3.1.10": return E_3_1_10 = (E_3_1_10 ?? new ScoringLine() );
                case "E.3.1.11": return E_3_1_11 = (E_3_1_11 ?? new ScoringLine() );
                case "E.3.1.12": return E_3_1_12 = (E_3_1_12 ?? new ScoringLine() );
                case "E.3.1.13": return E_3_1_13 = (E_3_1_13 ?? new ScoringLine() );
                case "E.3.1.14": return E_3_1_14 = (E_3_1_14 ?? new ScoringLine() );
                case "E.3.1.15": return E_3_1_15 = (E_3_1_15 ?? new ScoringLine() );
                case "E.3.1.16": return E_3_1_16 = (E_3_1_16 ?? new ScoringLine() );
                case "E.3.1.17": return E_3_1_17 = (E_3_1_17 ?? new ScoringLine() );
                case "E.3.2": return E_3_2 = (E_3_2 ?? new ScoringLine() );
                case "P.1": return P_1 = (P_1 ?? new ScoringLine() );
                case "P.2": return P_2 = (P_2 ?? new ScoringLine() );
                case "P.3": return P_3 = (P_3 ?? new ScoringLine() );
                case "P.4": return P_4 = (P_4 ?? new ScoringLine() );
                case "P.5": return P_5 = (P_5 ?? new ScoringLine() );
                case "P.6": return P_6 = (P_6 ?? new ScoringLine() );
                case "P.7": return P_7 = (P_7 ?? new ScoringLine() );
                case "P.8": return P_8 = (P_8 ?? new ScoringLine() );
                case "P.9": return P_9 = (P_9 ?? new ScoringLine() );
                case "P.10": return P_10 = (P_10 ?? new ScoringLine() );
                case "P.11": return P_11 = (P_11 ?? new ScoringLine() );
                case "P.12": return P_12 = (P_12 ?? new ScoringLine() );



            }

            return null;
        }

        public string GetCSVLine()
        {
            var sb = new StringBuilder();

            sb.Append(E.Score); sb.Append(",");
            sb.Append(E_1.Score); sb.Append(",");
            sb.Append(E_2.Score); sb.Append(",");
            sb.Append(E_3.Score); sb.Append(",");

            sb.Append(S.Score); sb.Append(",");
            sb.Append(S_1.Score); sb.Append(",");
            sb.Append(S_2.Score); sb.Append(",");
            sb.Append(S_3.Score); sb.Append(",");
            sb.Append(S_4.Score); sb.Append(",");
            sb.Append(S_5.Score); sb.Append(",");

            sb.Append(G.Score); sb.Append(",");
            sb.Append(G_1.Score); sb.Append(",");
            sb.Append(G_2.Score); sb.Append(",");
            sb.Append(G_3.Score); sb.Append(",");

            sb.Append(P.Score); sb.Append(",");




            sb.Append(G_1_1_1.Score); sb.Append(',');
            sb.Append(G_1_2.Score); sb.Append(',');
            sb.Append(G_1_3.Score); sb.Append(',');
            sb.Append(G_1_3_1.Score); sb.Append(',');
            sb.Append(G_1_3_2.Score); sb.Append(',');
            sb.Append(G_1_3_3.Score); sb.Append(',');
            sb.Append(G_1_3_4.Score); sb.Append(',');
            sb.Append(G_1_3_5.Score); sb.Append(',');
            sb.Append(G_1_4.Score); sb.Append(',');
            sb.Append(G_1_4_1.Score); sb.Append(',');
            sb.Append(G_1_4_3.Score); sb.Append(',');
            sb.Append(G_1_4_4.Score); sb.Append(',');
            sb.Append(G_1_4_5.Score); sb.Append(',');
            sb.Append(G_1_4_6.Score); sb.Append(',');
            sb.Append(G_1_5.Score); sb.Append(',');
            sb.Append(G_2_1.Score); sb.Append(',');
            sb.Append(G_2_2.Score); sb.Append(',');
            sb.Append(G_2_3.Score); sb.Append(',');
            sb.Append(G_2_4.Score); sb.Append(',');
            sb.Append(G_2_5.Score); sb.Append(',');
            sb.Append(G_2_5_1.Score); sb.Append(',');
            sb.Append(G_2_6.Score); sb.Append(',');
            sb.Append(G_2_7.Score); sb.Append(',');
            sb.Append(G_2_8.Score); sb.Append(',');
            sb.Append(G_2_9.Score); sb.Append(',');
            sb.Append(G_2_10.Score); sb.Append(',');
            sb.Append(G_2_11.Score); sb.Append(',');
            sb.Append(G_2_12.Score); sb.Append(',');
            sb.Append(G_2_13.Score); sb.Append(',');
            sb.Append(G_3_1.Score); sb.Append(',');
            sb.Append(G_3_2.Score); sb.Append(',');
            sb.Append(G_3_3_1.Score); sb.Append(',');
            sb.Append(G_3_4.Score); sb.Append(',');
            sb.Append(S_1_1.Score); sb.Append(',');
            sb.Append(S_1_1_1.Score); sb.Append(',');
            sb.Append(S_1_2.Score); sb.Append(',');
            sb.Append(S_1_3.Score); sb.Append(',');
            sb.Append(S_1_4.Score); sb.Append(',');
            sb.Append(S_1_5.Score); sb.Append(',');
            sb.Append(S_1_5_1.Score); sb.Append(',');
            sb.Append(S_1_6.Score); sb.Append(',');
            sb.Append(S_1_6_1.Score); sb.Append(',');
            sb.Append(S_1_6_2.Score); sb.Append(',');
            sb.Append(S_1_6_3.Score); sb.Append(',');
            sb.Append(S_1_6_4.Score); sb.Append(',');
            sb.Append(S_1_6_5.Score); sb.Append(',');
            sb.Append(S_1_6_6.Score); sb.Append(',');
            sb.Append(S_1_7.Score); sb.Append(',');
            sb.Append(S_2_1.Score); sb.Append(',');
            sb.Append(S_2_1_1.Score); sb.Append(',');
            sb.Append(S_2_1_2.Score); sb.Append(',');
            sb.Append(S_2_1_3.Score); sb.Append(',');
            sb.Append(S_2_2.Score); sb.Append(',');
            sb.Append(S_2_2_1.Score); sb.Append(',');
            sb.Append(S_2_2_2.Score); sb.Append(',');
            sb.Append(S_2_2_3.Score); sb.Append(',');
            sb.Append(S_2_2_4.Score); sb.Append(',');
            sb.Append(S_2_3.Score); sb.Append(',');
            sb.Append(S_3_1_1.Score); sb.Append(',');
            sb.Append(S_3_1_2.Score); sb.Append(',');
            sb.Append(S_3_1_3.Score); sb.Append(',');
            sb.Append(S_3_1_4.Score); sb.Append(',');
            sb.Append(S_3_1_5.Score); sb.Append(',');
            sb.Append(S_3_1_6.Score); sb.Append(',');
            sb.Append(S_3_1_7.Score); sb.Append(',');
            sb.Append(S_3_1_8.Score); sb.Append(',');
            sb.Append(S_3_1_9.Score); sb.Append(',');
            sb.Append(S_3_1_10.Score); sb.Append(',');
            sb.Append(S_3_1_11.Score); sb.Append(',');
            sb.Append(S_3_1_12.Score); sb.Append(',');
            sb.Append(S_3_2_1.Score); sb.Append(',');
            sb.Append(S_3_3.Score); sb.Append(',');
            sb.Append(S_4_1.Score); sb.Append(',');
            sb.Append(S_4_2_1.Score); sb.Append(',');
            sb.Append(S_4_2_2.Score); sb.Append(',');
            sb.Append(S_4_2_3.Score); sb.Append(',');
            sb.Append(S_4_2_4.Score); sb.Append(',');
            sb.Append(S_4_2_5.Score); sb.Append(',');
            sb.Append(S_4_2_6.Score); sb.Append(',');
            sb.Append(S_4_2_7.Score); sb.Append(',');
            sb.Append(S_4_2_8.Score); sb.Append(',');
            sb.Append(S_4_2_9.Score); sb.Append(',');
            sb.Append(S_4_2_10.Score); sb.Append(',');
            sb.Append(S_4_2_11.Score); sb.Append(',');
            sb.Append(S_4_2_12.Score); sb.Append(',');
            sb.Append(S_4_2_13.Score); sb.Append(',');
            sb.Append(S_4_2_14.Score); sb.Append(',');
            sb.Append(S_4_3.Score); sb.Append(',');
            sb.Append(S_5_1.Score); sb.Append(',');
            sb.Append(S_5_2.Score); sb.Append(',');
            sb.Append(S_5_3.Score); sb.Append(',');
            sb.Append(E_1_1.Score); sb.Append(',');
            sb.Append(E_1_1_1.Score); sb.Append(',');
            sb.Append(E_1_2.Score); sb.Append(',');
            sb.Append(E_1_2_1.Score); sb.Append(',');
            sb.Append(E_1_2_2.Score); sb.Append(',');
            sb.Append(E_1_2_3.Score); sb.Append(',');
            sb.Append(E_1_2_4.Score); sb.Append(',');
            sb.Append(E_1_2_6.Score); sb.Append(',');
            sb.Append(E_1_2_7.Score); sb.Append(',');
            sb.Append(E_1_2_8.Score); sb.Append(',');
            sb.Append(E_1_3.Score); sb.Append(',');
            sb.Append(E_1_3_2.Score); sb.Append(',');
            sb.Append(E_1_3_3.Score); sb.Append(',');
            sb.Append(E_1_3_4.Score); sb.Append(',');
            sb.Append(E_1_3_5.Score); sb.Append(',');
            sb.Append(E_1_4.Score); sb.Append(',');
            sb.Append(E_1_5.Score); sb.Append(',');
            sb.Append(E_1_6.Score); sb.Append(',');
            sb.Append(E_1_7.Score); sb.Append(',');
            sb.Append(E_1_7_1.Score); sb.Append(',');
            sb.Append(E_1_7_2.Score); sb.Append(',');
            sb.Append(E_1_8.Score); sb.Append(',');
            sb.Append(E_1_9.Score); sb.Append(',');
            sb.Append(E_1_10.Score); sb.Append(',');
            sb.Append(E_1_11.Score); sb.Append(',');
            sb.Append(E_1_12.Score); sb.Append(',');
            sb.Append(E_2_1.Score); sb.Append(',');
            sb.Append(E_2_1_1.Score); sb.Append(',');
            sb.Append(E_2_1_2.Score); sb.Append(',');
            sb.Append(E_2_1_3.Score); sb.Append(',');
            sb.Append(E_2_1_4.Score); sb.Append(',');
            sb.Append(E_2_1_5.Score); sb.Append(',');
            sb.Append(E_2_1_6.Score); sb.Append(',');
            sb.Append(E_2_1_7.Score); sb.Append(',');
            sb.Append(E_2_1_8.Score); sb.Append(',');
            sb.Append(E_2_1_9.Score); sb.Append(',');
            sb.Append(E_2_1_10.Score); sb.Append(',');
            sb.Append(E_2_2.Score); sb.Append(',');
            sb.Append(E_3_1_1.Score); sb.Append(',');
            sb.Append(E_3_1_2.Score); sb.Append(',');
            sb.Append(E_3_1_3.Score); sb.Append(',');
            sb.Append(E_3_1_4.Score); sb.Append(',');
            sb.Append(E_3_1_5.Score); sb.Append(',');
            sb.Append(E_3_1_6.Score); sb.Append(',');
            sb.Append(E_3_1_7.Score); sb.Append(',');
            sb.Append(E_3_1_8.Score); sb.Append(',');
            sb.Append(E_3_1_9.Score); sb.Append(',');
            sb.Append(E_3_1_10.Score); sb.Append(',');
            sb.Append(E_3_1_11.Score); sb.Append(',');
            sb.Append(E_3_1_12.Score); sb.Append(',');
            sb.Append(E_3_1_13.Score); sb.Append(',');
            sb.Append(E_3_1_14.Score); sb.Append(',');
            sb.Append(E_3_1_15.Score); sb.Append(',');
            sb.Append(E_3_1_16.Score); sb.Append(',');
            sb.Append(E_3_1_17.Score); sb.Append(',');
            sb.Append(E_3_2.Score); sb.Append(',');
            sb.Append(P_1.Score); sb.Append(',');
            sb.Append(P_2.Score); sb.Append(',');
            sb.Append(P_3.Score); sb.Append(',');
            sb.Append(P_4.Score); sb.Append(',');
            sb.Append(P_5.Score); sb.Append(',');
            sb.Append(P_6.Score); sb.Append(',');
            sb.Append(P_7.Score); sb.Append(',');
            sb.Append(P_8.Score); sb.Append(',');
            sb.Append(P_9.Score); sb.Append(',');
            sb.Append(P_10.Score); sb.Append(',');
            sb.Append(P_11.Score); sb.Append(',');
            sb.Append(P_12.Score); sb.Append(',');

            return sb.ToString();
        }
    }
}                                        